<?php

namespace app\queue\stomp;

use app\queue\BaseConsumer;
use common\model\TaskModel;
use common\service\CommonService;
use common\service\ReviewRequestService;
use Webman\Stomp\RetryAbleConsumer;

class DelayOrderTaskReviewConsumer extends BaseConsumer implements RetryAbleConsumer
{
    // 要消费的队列名
    public $queue = 'delay_order_task_review';

    // 连接名，对应 config/redis_queue.php 里的连接`
    public $connection = 'default';

    public function doConsume($data)
    {
        ReviewRequestService::getInstance()->delayOrderTaskReview($data['review_request'], $data['review_request_node']);
    }


    public function getTtr()
    {
        return 20;
    }

    public function canRetry($attempt, $error)
    {
        trace(format_exception_info($error), 'ERR');
        return $attempt <= 3;
    }
}